package com.flywen.utils;

import org.apache.commons.codec.binary.Base64;

public class Base64Utils {
    public Base64Utils() {
    }

    public static String decryptBase64(String str) {
        byte[] bytes = str.getBytes();
        Base64 base64 = new Base64();
        bytes = base64.decode(bytes);
        String result = new String(bytes);
        return result;
    }

    public static byte[] decryptBase64(byte[] str) {
        Base64 base64 = new Base64();
        str = base64.decode(str);
        return str;
    }

    public static String encryptBase64(String str) {
        byte[] bytes = str.getBytes();
        Base64 base64 = new Base64();
        bytes = base64.encode(bytes);
        String result = new String(bytes);
        return result;
    }

    public static String encryptBase64(byte[] str) {
        Base64 base64 = new Base64();
        str = base64.encode(str);
        String result = new String(str);
        return result;
    }
}
